package com.myproject.zhujiemian;

import com.itheima.tencentqq52.R;
import com.myproject.database.MYdatabase;
import android.app.Activity;
import android.content.Intent;
import android.database.sqlite.SQLiteDatabase;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.VideoView;

public class ToDoTask extends Activity {
	private static final String TAG = "ToDoTask";
	private Button bt_todotask, bt_taskdelete;
	private TextView text_outtask;
	private MYdatabase taskDB;
	private SQLiteDatabase dbWriter;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.todotask);
		// System.out.println(getIntent().getIntExtra(MYdatabase.ID, 0));
		// bt_taskdelete = (Button) findViewById(R.id.bt_taskdelete);
		bt_todotask = (Button) findViewById(R.id.bt_todotask);
		bt_taskdelete = (Button) findViewById(R.id.bt_taskdelete);
		text_outtask = (TextView) findViewById(R.id.text_outtask);
		// bt_backzhubuju.setOnClickListener(this);
		// bt_taskdelete.setOnClickListener(this);
		taskDB = new MYdatabase(this);
		dbWriter = taskDB.getWritableDatabase();
		text_outtask.setText(getIntent().getStringExtra(MYdatabase.CONTENT));

	}

	// @Override
	// public void onClick(View v) {
	// switch (v.getId()) {
	// case R.id.bt_taskdelete:
	// deleteDate();
	// finish();
	// break;
	//
	// case R.id.bt_backzhubuju:
	// finish();
	// break;
	// }
	// }

	public void deleteDate() {
		dbWriter.delete(MYdatabase.TABLE_NAME, "_id="
				+ getIntent().getIntExtra(MYdatabase.ID, 0), null);
		// Log.i(TAG,
		// "--------------------------------------------------------");
	}


	public void ToDoTask(View view) {
		Intent intent = new Intent();
		intent.setAction("com.myproject.TaskJishi");
		intent.putExtra(MYdatabase.ID, getIntent().getIntExtra(MYdatabase.ID, 0));
//		intent.putExtra(MYdatabase.CONTENT, getIntent().getIntExtra(MYdatabase.CONTENT, 0));
		startActivity(intent);

	}

	// 跳转到任务页面
	public void DeleteTask(View view) {
		deleteDate();
		finish();
	}

}
